#ifndef __C1F8B13F_3A44_4c49_A776_CE4056CBC8D5__
#define __C1F8B13F_3A44_4c49_A776_CE4056CBC8D5__

#include "../import/head.h"
#include "../tools/head.h"

/////////////////////////////////////////////////////////////////////////////////////////
// 
namespace xos
{
    class msg_impl;

    // 
    // buf interface
    // 
    class buf_impl : public xos_stl::mem_pool_item< buf_impl, thread_lock >,
        public i_buf
    {
    public:
        buf_impl();
        ~buf_impl();

    public:
        // 
        // buf variable
        // 
        char m_szBuf[BUF_SIZE];
        int m_nLen;
        int m_nPos;

    public:
        int init();
        int term();

    public:
        // 
        // read data
        // 
        char * get_data( char * lpszData, int nLen, int * lpnLenNeeded );
        int set_data( const char * lpszData, int nLen );

        // 
        // get data len
        // 
        int get_len( int * lpnDataLen );
        int set_len( int nLen );

        // 
        // set pos;
        // 
        int get_pos( int * lpnPos );
        int set_pos( int xPos );

        // 
        // get buf size. total buf size
        // 
        int get_buf_size( int * lpnBufLen );

        // 
        // release
        // 
        int release();
    };
}

#endif // __C1F8B13F_3A44_4c49_A776_CE4056CBC8D5__
